package com.hyhy.hycloud.commons.support;

import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.cglib.core.Converter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils;

/**
 * @author lanpengfei
 * @date 2018/12/24
 */
@Configuration
@ConditionalOnClass(Converter.class)
public class IgnoreEmptyConverterConfig {
    @Bean
    public Converter ignoreEmptyConverter(){
        return (o, aClass, o1) -> StringUtils.isEmpty(o) ? null : o;
    }
}
